<template>
  <div>
    <el-form :inline="true">
      <el-form-item>
        <el-input
          v-model="searchForm.login_user_name"
          placeholder="用户名"
          clearable
        >
        </el-input>
      </el-form-item>

      <el-form-item>
        <el-button @click="getUserList">搜索</el-button>
      </el-form-item>
    </el-form>

    <el-table
            ref="multipleTable"
            :data="tableData"
            tooltip-effect="dark"
            style="width: 100%"
            border
            stripe
          >
            <el-table-column type="index" width="55" label="序号">
              <template slot-scope="scope">
                <span>{{ (page - 1) * limit + scope.$index + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="operate_user_name"
              width="110"
              label="用户姓名"
            ></el-table-column>
            <el-table-column
              prop="operate_type"
              width="90"
              label="操作类型"
            ></el-table-column>
            <el-table-column
              prop="operate_desc"
              label="操作内容"
            ></el-table-column>
            <el-table-column
              prop="operate_url"
              width="170"
              label="操作地址"
            ></el-table-column>
            <el-table-column
              prop="create_time"
              width="200"
              label="登陆时间"
            ></el-table-column>
          </el-table>

    <!-- 分页 -->
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      layout="total, sizes, prev, pager, next, jumper"
      :page-sizes="[10, 20, 50, 100]"
      :current-page="page"
      :page-size="limit"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "Role",
  data() {
    return {
      searchForm: {},
      delBtlStatu: true,
      total: 0,
      page: 1,
      limit: 10,
      tableData: [],
    };
  },
  created() {
    this.getUserList();
  },
  methods: {
    handleSizeChange(val) {
      this.limit = val;
      this.getUserList();
    },
    handleCurrentChange(val) {
      this.page = val;
      this.getUserList();
    },
    //获取用列表
    getUserList() {
      let data = {
        page: this.page,
        limit: this.limit,
        search: this.searchForm,
      };
      this.$axios.post("admin/log/log_list", data).then((res) => {
        this.tableData = res.data.data.list;
        this.total = res.data.data.total;
      });
    },
  },
};
</script>

<style scoped>
.el-pagination {
  float: right;
  margin-top: 22px;
}
</style>